import { defineConfig } from '@vben/vite-config';

export default defineConfig(async () => {
  return {
    application: {},
    vite: {
      server: {
        proxy: {
          '/api': {
            changeOrigin: true,
            // 去掉 /api 前缀，转发到后端
            // 前端: /api/auth/api/login -> 后端: /auth/api/login
            // 前端: /api/system/api/menu/tree -> 后端: /system/api/menu/tree
            // 前端: /api/system/doc.html -> 后端: /system/doc.html
            rewrite: (path) => path.replace(/^\/api/, ''),
            target: 'http://192.168.1.22:11500',
            ws: true,
          },
        },
      },
    },
  };
});
